<script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
<script src="./index.js"></script>
<link href="./index.css" rel="stylesheet"/>

<p id="p" contenteditable>Hello world</p>
<div id="editorjs"></div>

<button id="save-button">Save</button>
<pre id="output"></pre>

<script>
  p.onfocus = () => {
    p.addEventListener('keydown', e => {
      console.log(e.keyCode)
    })
    
  }
</script>

<script>
  const editor = new EditorJS({
    autofocus: true,
    tools: {
      image: {
        class: Imagetool,
        inlineToolbar: ['link']
      }
    },
    data: {
      time: 1552744582955,
      blocks: [
        {
          type: "image",
          data: {
            url: "https://cdn.pixabay.com/photo/2017/09/01/21/53/blue-2705642_1280.jpg",
            caption: 'bear1231231312312<a href="http://123123132">313</a>'
          }
        },
        {
          "type": "image",
          "data": {
            "url": ""
          }
        },
        {
          "type": "image",
          "data": {
            "url": ""
          }
        }
      ],
      version: "2.11.10"
    }
  });

  var saveBtn = document.getElementById('save-button')
  var output = document.getElementById('output')

  saveBtn.addEventListener('click', () => {
    editor.save().then(res => {
      output.innerHTML = JSON.stringify(res, null, 4)
    })
  })
</script>